﻿using B.S.Medical.Api.Write.Application.Command.Register;
using B.S.Medical.ErrorCode;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace B.S.Medical.Api.Write.Controllers.Register
{
    /// <summary>
    /// 预约挂号控制器(写)
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class RegisterController : ControllerBase
    {
        private readonly IMediator mediator;

        public RegisterController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 新增预约须知
        /// </summary>
        /// <returns>返回统一包装类</returns>
        [HttpPost]
        public async Task<ApiResult<int>> AddAppointmentNotice(AddAppointmentNoticeCommand request)
        {
            return await mediator.Send(request);
        }


        /// <summary>
        /// 修改挂号备注
        /// </summary>
        /// <param name="command">修改取消原因命令</param>
        /// <returns>操作结果</returns>
        [HttpPut("UpdateCancelReason")]
        public async Task<ApiResult<int>> UpdateCancelReason([FromBody] UpdateRegisterCancelReasonCommand command)
        {
            return await mediator.Send(command);
        }
        /// <summary>
        /// 添加挂号记录
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>

        [HttpPost]
        public async Task<ApiResult<int>> AddRegister(AddRegisterCommand request)
        {
            return await mediator.Send(request);
        }



    }
}
